<template>
	<view class="rawMaterialSource">
		<view >
			<view class="content">
				<view class="content_item">产品产地：<text>{{info.baseName}}</text></view>
				<view class="content_item">地理位置：<text>{{info.baseAddress}}</text></view>
				<view class="content_item">基地海拔：<text>{{info.baseElevation}}</text></view>
				<view class="content_item">面积：<text>{{info.baseArea}}</text></view>
				<view class="content_item">品种：<text>{{info.basePlant}}</text></view>
				<view class="content_item">气候条件：<text>{{info.baseWeather}}</text></view>
				<view class="content_item">土壤类型：<text>{{info.baseSoil}}</text></view>
			</view>
			<view class="baseImage">
				<view class="baseImage_title">基地照片:</view>
				<view class=""><image @click="lookover(info.basePic)"  :src="info.basePic" mode=""></image></view>
			</view>
			<!-- <view class="plantImage">
				<view class="plantImage_title">植株照片:</view>
				<view class=""><image @click="lookover(info.basePic)" :src="info.basePic" mode=""></image></view>
			</view> -->
		</view>
	</view>
</template>

<script>
	// 		 			 已检项目
	import {imgUrl,getbase} from "../../api/api_test.js"
	export default {
		data() {
			return {
				productId:'',
				info:{},
				weatherType:[
					{dictValue:0,dictLabel:'晴朗'},
					{dictValue:1,dictLabel:'干燥'},
					{dictValue:2,dictLabel:'湿润'},
					{dictValue:3,dictLabel:'阴凉'},
					{dictValue:4,dictLabel:'冰冷'},
				],
				soilType:[
					{dictValue:0,dictLabel:'砂纸土'},
					{dictValue:1,dictLabel:'黏质土'},
					{dictValue:2,dictLabel:'壤土'},
				],
				imgUrl:imgUrl
			};
		},
		onLoad(options){
			this.productId = options.productId
			this.getbase()
		},
		methods:{
			// 原料溯源
			getbase(){
				getbase({productId:this.productId},res=>{
					console.log("res 原料溯源",res)
					if(res.code == 200 && res.data){
						this.info = res.data
						this.info.basePic = this.imgUrl + this.info.basePic
						this.fn(this.weatherType,'baseWeather')
						this.fn(this.soilType,'baseSoil')
					}
				})
			},
			fn(arr,para){
				arr.forEach(val=>{
					if(val.dictValue == this.info[para]){
						this.info[para] = val.dictLabel
					}
				})
			},
			lookover(url){
				// console.log("url",url)
				uni.previewImage({
					urls:[url]
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.rawMaterialSource{
	flex: 1;
	background: url(../../static/maizi.png) no-repeat;
	background-size: 100% 100% ;
	>view{
		padding: 20rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		.content{
			width: 100%;
			padding: 0 20rpx;
			box-sizing: border-box;
			font-size: 28rpx;
			// font-weight: bold;
			.content_item{
				line-height: 80rpx;
				display: flex;
				justify-content: space-between;
				border-bottom: 1px solid #B7B7B7;
				text{
					color: #B7B7B7;
				}
			}
		}
		.baseImage{
			padding: 0 20rpx;
			box-sizing: border-box;
			.baseImage_title{
				width: 100%;
				color: #9AC454;
				font-size: 40rpx;
				margin-top: 60rpx ;
			}
			image{
				width: 100%;
				margin: 20rpx 0;
				height: 350rpx;
			}
		}
		.plantImage{
			padding: 0 20rpx;
			box-sizing: border-box;
			.plantImage_title{
				width: 100%;
				color: #9AC454;
				font-size: 40rpx;
				margin-top: 60rpx ;
			}
			image{
				width: 100%;
				margin: 20rpx 0;
				height: 350rpx;
			}
		}
	}
}
</style>
